From f243cb4f692bc89d074b534a43ba0ed5fbe20f6d Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Wed, 15 May 2024 17:54:11 -0700
Subject: feat(badges): allow dismiss notice

---
 src/routes/user/[user]/badges/+page.svelte | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

(limited to 'src/routes/user/[user]/badges/+page.svelte')

diff --git a/src/routes/user/[user]/badges/+page.svelte b/src/routes/user/[user]/badges/+page.svelte
index 2614cb13..565cb73b 100644
--- a/src/routes/user/[user]/badges/+page.svelte
+++ b/src/routes/user/[user]/badges/+page.svelte
@@ -59,6 +59,7 @@
 	let hideMode = false;
 	let preferences: UserPreferences;
 	const authorised = authorisedJson.includes($identity.id);
+	let noticeDismissed = false;
 
 	$: categoryFilter = new URLSearchParams($page.url.searchParams).get('category');
 
@@ -76,6 +77,8 @@
 	onMount(async () => {
 		// socket.on('badges', (message) => (badges = message));
 
+		if (browser && localStorage.getItem('badgeWallNoticeDismissed')) noticeDismissed = true;
+
 		badger = isId
 			? {
 					id: parseInt(data.username),
@@ -515,7 +518,7 @@
 										will be required to use the hide feature to hide these badges from the public, while
 										allowing them to stay visible to you as the account holder.
 									</div>
-								{:else}
+								{:else if !noticeDismissed}
 									<div class="card">
 										<b>Notice:</b> AniList has begun purging outbound links which contain
 										AI-generated material, this includes Badge Wall. If you have collected badges
@@ -525,6 +528,16 @@
 										<p />
 										Failure to comply with this request at your earliest convenience will result in the
 										hiding of all badges from your Badge Wall.
+										<p />
+										<button
+											on:click={() => {
+												noticeDismissed = true;
+
+												localStorage.setItem('badgeWallNoticeDismissed', 'true');
+											}}
+										>
+											Dismiss
+										</button>
 									</div>
 								{/if}
 
-- 
cgit v1.2.3

